﻿// TestClient.MaxFileSize.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.html)
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       MaxFileSize.cs
// Author:     HSS\gbanta
// Created:    07/16/2011
// Modified:   07/16/2011
// ----------------------------------------------------------------------------
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace TestClient
{
	public class MaxFileSize : INotifyPropertyChanged
	{
		//<ComboBoxItem Content="512 bytes" Tag="512" IsSelected="True" />
		//<ComboBoxItem Content="1024 bytes (1KB)" Tag="1024" />
		//<ComboBoxItem Content="1024 kb (1MB)" Tag="1048576" />
		//<ComboBoxItem Content="5120 kb (5MB)" Tag="5242880" />
		//<ComboBoxItem Content="51200 kb (50MB)" Tag="5242880" />
		//<ComboBoxItem Content="Unlimited" Tag="*" />

		public MaxFileSize()
		{

		}

		public static ObservableCollection<MaxFileSize> MaxFileSizes
		{
			get
			{
				if (null == _maxFileSizes)
				{
					_maxFileSizes = new ObservableCollection<MaxFileSize>();
					_maxFileSizes.Add(new MaxFileSize()
					{
						Bytes = 512,
						DisplayValue = "512 bytes"
					});
					_maxFileSizes.Add(new MaxFileSize()
					{
						Bytes = 1024,
						DisplayValue = "1KB (1024 bytes)"
					});
					_maxFileSizes.Add(new MaxFileSize()
					{
						Bytes = 1048576,
						DisplayValue = "1MB (1024 KB)"
					});
					_maxFileSizes.Add(new MaxFileSize()
					{
						Bytes = 5242880,
						DisplayValue = "5MB (5120 KB)"
					});
					_maxFileSizes.Add(new MaxFileSize()
					{
						Bytes = 52428800,
						DisplayValue = "50MB (51200 KB)"
					});
					_maxFileSizes.Add(new MaxFileSize()
					{
						Bytes = int.MaxValue,
						DisplayValue = "Unlimited (Int32.MaxValue)"
					});
				}
				return _maxFileSizes;
			}
		} static ObservableCollection<MaxFileSize> _maxFileSizes;


		public int Bytes { get; set; }
		public string DisplayValue { get; set; }

		public override string ToString()
		{
			return this.DisplayValue;
		}

		#region INotifyPropertyChanged Members

		public event PropertyChangedEventHandler PropertyChanged;
		void OnPropertyChanged(string propertyName)
		{
			var handler = this.PropertyChanged;
			if (null != handler)
				handler(this, new PropertyChangedEventArgs(propertyName));
		}

		#endregion
	}
}